<#include "/common/taglibs.ftl" />
<@menu code='${entityName!}'/>
<title><@spring.message code="${entityName!}" /> - <@spring.message code="list" /></title>
<div class="m-portlet m-portlet--mobile m-portlet--tabs">
    <div class="m-portlet__head">
        <div class="m-portlet__head-caption">
            <div class="m-portlet__head-title">
                <h3 class="m-portlet__head-text">
                <@spring.message code="${entityName!}"/> (Form Search)
                </h3>
            </div>
        </div>
        <div class="m-portlet__head-tools">
        <#include "/showcase/crud/sample/tabs.ftl" />
        </div>
    </div>
    <div class="m-portlet__body">
        <div class="table-container">
            <div class="search-filters m--margin-bottom-20">
                <div class="row m--margin-bottom-20">
                    <div class="col-lg-3 m--margin-bottom-10-tablet-and-mobile">
                        <label><@spring.message code="sample.name"/></label>
                        <input type="text" class="form-control m-input form-filter" placeholder="E.g: zhansgan" name="search_LIKE_name">
                    </div>
                    <div class="col-lg-3 m--margin-bottom-10-tablet-and-mobile">
                        <label><@spring.message code="sample.email"/></label>
                        <input type="text" class="form-control m-input form-filter" placeholder="E.g: 12345678@qq.com" name="search_LIKE_email">
                    </div>
                    <div class="col-lg-3 m--margin-bottom-10-tablet-and-mobile">
                        <label><@spring.message code="sample.gender"/></label>
                        <select class="form-control m-input form-filter" name="search_EQ_gender">
                            <option value=""><@spring.message code="select..." /></option>
                            <#list genders as item>
                                <option value="${item}"><@spring.message code="${item.info}"/></option>
                            </#list>
                        </select>
                    </div>
                </div>

                <#--<div class="m-separator m-separator--md m-separator--dashed"></div>-->

                <div class="row">
                    <div class="col-lg-12">
                        <button class="btn btn-brand m-btn m-btn--icon filter-submit">
                            <span>
                                <i class="la la-search"></i>
                                <span><@spring.message code="button.search"/></span>
                            </span>
                        </button>
                        &nbsp;&nbsp;
                        <button class="btn btn-secondary m-btn m-btn--icon filter-cancel">
                            <span>
                                <i class="la la-close"></i>
                                <span><@spring.message code="button.reset"/></span>
                            </span>
                        </button>
                    </div>
                </div>

            </div>
            <table class="table table-striped- table-bordered table-hover table-checkable" id="datatable"
                   data-datatable="true"
                   data-datatable-draw-callback="drawCallback"
            >
                <thead>
                    <tr role="row" class="heading">
                        <th width="1%" data-checkable="true" data-orderable="false"></th>
                        <th width="5%" data-data="id" data-searchable="false"> ID# </th>
                        <th width="5%" data-data="name"> <@spring.message code="sample.name"/> </th>
                        <th width="8%" data-data="gender" data-render="renderGender" data-search-type="<@searchTypeSelect items=genders/>"> <@spring.message code="sample.gender"/> </th>
                        <th data-data="email"> <@spring.message code="sample.email"/> </th>
                        <th width="8%" data-data="activated" data-render="renderBoolean" data-search-type="<@searchTypeSelectBoolean/>"> <@spring.message code="activated"/> </th>
                        <th width="5%" class="center" data-data="age" data-search-type="range" > <@spring.message code="sample.age"/> </th>
                        <th width="5%" class="center" data-data="salary" data-search-type="range" > <@spring.message code="sample.salary"/> </th>
                        <th width="10%" class="center" data-data="birthday" data-search-type="daterange" data-render="renderDate"> <@spring.message code="sample.birthday"/> </th>
                        <th width="15%" class="center" data-data="lastModifiedDate" data-search-type="daterange" data-render="renderDateTime"> <@spring.message code="lastModifyDate"/> </th>
                        <#--<th width="15%" data-actions="<@tableColumnButtons resourceIdentity='${resourceIdentity!}'/>"> <@spring.message code="action"/> </th>-->
                        <th width="15%" data-actions="111"> <@spring.message code="action"/> </th>
                    </tr>
                </thead>
                <tbody> </tbody>
            </table>
        </div>
    </div>
</div>

<page-plugin-style>
</page-plugin-style>
<page-style>
</page-style>
<page-plugin-script>
</page-plugin-script>
<page-script>
    <script>
        function renderGender( data, type, full, meta ){
            if(data=='male'){
                return '<@spring.message code="gender.male"/>';
            } else {
                return '<@spring.message code="gender.female"/>';
            }
        }

        var drawCallback = function(grid, $table){
            console.log('user table draw callback', grid, $table);
            if(grid.getDataTable().data().length==0) return;
        }
    </script>
</page-script>